/*
 * ConvertDKTView.java
 */

package com.pit.convert.dkt;


import com.sap.conn.jco.JCoException;
import javax.xml.parsers.ParserConfigurationException;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

import com.pit.convert.system.Constants;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.logging.Level;
import javax.swing.JOptionPane;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import com.pit.convert.utility.Utility;

/**
 * The application's main frame.
 */
public class ConvertDKTView extends FrameView {

    public ConvertDKTView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });          
        
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = ConvertDKTApp.getApplication().getMainFrame();
            aboutBox = new ConvertDKTAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        ConvertDKTApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        tabDKT = new javax.swing.JTabbedPane();
        pnlDKT = new javax.swing.JPanel();
        btnCheckXML = new javax.swing.JButton();
        pnlScand = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        txtScandFolder = new javax.swing.JTextField();
        btnSndFld = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        txtBckFolder = new javax.swing.JTextField();
        btnBckFld = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        txtFileLog = new javax.swing.JTextField();
        btnLogFile = new javax.swing.JButton();
        txtThread = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        chkAddress = new javax.swing.JCheckBox();
        lblDelCACO = new javax.swing.JLabel();
        chkDelCACO = new javax.swing.JCheckBox();
        lblDisplay = new java.awt.Label();
        pnlCheck = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtSrcFolder = new javax.swing.JTextField();
        btnSrcFld = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        txtTagFolder = new javax.swing.JTextField();
        btnTgrFld = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        txtErrFolder = new javax.swing.JTextField();
        btnErrFld = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        txtChkXMLLog = new javax.swing.JTextField();
        btnLogFile1 = new javax.swing.JButton();
        btnConvert = new javax.swing.JButton();
        btnClose = new javax.swing.JButton();
        pnlExTXT = new javax.swing.JPanel();
        txtImport = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtExport = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        btnExport = new javax.swing.JButton();
        btnCloseEx = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        radText = new javax.swing.JRadioButton();
        radOracle = new javax.swing.JRadioButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jFileChooser1 = new javax.swing.JFileChooser();
        jFileChooser2 = new javax.swing.JFileChooser();
        btnGroupRadio = new javax.swing.ButtonGroup();

        mainPanel.setAutoscrolls(true);
        mainPanel.setName("mainPanel"); // NOI18N

        tabDKT.setName("tabDKT"); // NOI18N

        pnlDKT.setName("pnlDKT"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(com.pit.convert.dkt.ConvertDKTApp.class).getContext().getActionMap(ConvertDKTView.class, this);
        btnCheckXML.setAction(actionMap.get("checkXML")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(com.pit.convert.dkt.ConvertDKTApp.class).getContext().getResourceMap(ConvertDKTView.class);
        btnCheckXML.setText(resourceMap.getString("btnCheckXML.text")); // NOI18N
        btnCheckXML.setName("btnCheckXML"); // NOI18N

        pnlScand.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("pnlScand.border.title"))); // NOI18N
        pnlScand.setName("pnlScand"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        txtScandFolder.setText(resourceMap.getString("txtScandFolder.text")); // NOI18N
        txtScandFolder.setName("txtScandFolder"); // NOI18N

        btnSndFld.setAction(actionMap.get("PartScandFolder")); // NOI18N
        btnSndFld.setText(resourceMap.getString("btnSndFld.text")); // NOI18N
        btnSndFld.setName("btnSndFld"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        txtBckFolder.setText(resourceMap.getString("txtBckFolder.text")); // NOI18N
        txtBckFolder.setName("txtBckFolder"); // NOI18N

        btnBckFld.setAction(actionMap.get("PartBckFolder")); // NOI18N
        btnBckFld.setText(resourceMap.getString("btnBckFld.text")); // NOI18N
        btnBckFld.setName("btnBckFld"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        txtFileLog.setText(resourceMap.getString("txtFileLog.text")); // NOI18N
        txtFileLog.setName("txtFileLog"); // NOI18N

        btnLogFile.setAction(actionMap.get("PartLogFile")); // NOI18N
        btnLogFile.setText(resourceMap.getString("btnLogFile.text")); // NOI18N
        btnLogFile.setName("btnLogFile"); // NOI18N

        txtThread.setText(resourceMap.getString("txtThread.text")); // NOI18N
        txtThread.setName("txtThread"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        chkAddress.setSelected(true);
        chkAddress.setEnabled(false);
        chkAddress.setName("chkAddress"); // NOI18N

        lblDelCACO.setText(resourceMap.getString("lblDelCACO.text")); // NOI18N
        lblDelCACO.setName("lblDelCACO"); // NOI18N

        chkDelCACO.setSelected(true);
        chkDelCACO.setName("chkDelCACO"); // NOI18N

        javax.swing.GroupLayout pnlScandLayout = new javax.swing.GroupLayout(pnlScand);
        pnlScand.setLayout(pnlScandLayout);
        pnlScandLayout.setHorizontalGroup(
            pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlScandLayout.createSequentialGroup()
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlScandLayout.createSequentialGroup()
                        .addGap(98, 98, 98)
                        .addComponent(txtThread, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlScandLayout.createSequentialGroup()
                        .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlScandLayout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel7)
                                    .addGroup(pnlScandLayout.createSequentialGroup()
                                        .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel8)
                                            .addComponent(lblDelCACO))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(chkAddress)
                                            .addComponent(chkDelCACO)))))
                            .addGroup(pnlScandLayout.createSequentialGroup()
                                .addGap(98, 98, 98)
                                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(txtBckFolder, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
                                    .addComponent(txtScandFolder, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)))
                            .addGroup(pnlScandLayout.createSequentialGroup()
                                .addGap(98, 98, 98)
                                .addComponent(txtFileLog, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnBckFld, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnSndFld, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnLogFile, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        pnlScandLayout.setVerticalGroup(
            pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlScandLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel6)
                    .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtScandFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnSndFld)))
                .addGap(9, 9, 9)
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3)
                    .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtBckFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnBckFld)))
                .addGap(9, 9, 9)
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtFileLog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnLogFile)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(txtThread, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(pnlScandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlScandLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                        .addComponent(lblDelCACO))
                    .addGroup(pnlScandLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(chkAddress)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                        .addComponent(chkDelCACO))))
        );

        lblDisplay.setAlignment(java.awt.Label.CENTER);
        lblDisplay.setFont(resourceMap.getFont("lblDisplay.font")); // NOI18N
        lblDisplay.setForeground(resourceMap.getColor("lblDisplay.foreground")); // NOI18N
        lblDisplay.setName("lblDisplay"); // NOI18N
        lblDisplay.setText(resourceMap.getString("lblDisplay.text")); // NOI18N

        pnlCheck.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("pnlCheck.border.title"))); // NOI18N
        pnlCheck.setName("pnlCheck"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        txtSrcFolder.setText(resourceMap.getString("txtSrcFolder.text")); // NOI18N
        txtSrcFolder.setName("txtSrcFolder"); // NOI18N

        btnSrcFld.setAction(actionMap.get("PartSrcFolder")); // NOI18N
        btnSrcFld.setText(resourceMap.getString("btnSrcFld.text")); // NOI18N
        btnSrcFld.setName("btnSrcFld"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        txtTagFolder.setText(resourceMap.getString("txtTagFolder.text")); // NOI18N
        txtTagFolder.setName("txtTagFolder"); // NOI18N

        btnTgrFld.setAction(actionMap.get("PartTgrFolder")); // NOI18N
        btnTgrFld.setText(resourceMap.getString("btnTgrFld.text")); // NOI18N
        btnTgrFld.setName("btnTgrFld"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        txtErrFolder.setText(resourceMap.getString("txtErrFolder.text")); // NOI18N
        txtErrFolder.setName("txtErrFolder"); // NOI18N

        btnErrFld.setAction(actionMap.get("PartErrFolder")); // NOI18N
        btnErrFld.setText(resourceMap.getString("btnErrFld.text")); // NOI18N
        btnErrFld.setName("btnErrFld"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        txtChkXMLLog.setText(resourceMap.getString("txtChkXMLLog.text")); // NOI18N
        txtChkXMLLog.setName("txtChkXMLLog"); // NOI18N

        btnLogFile1.setAction(actionMap.get("PartLogFile")); // NOI18N
        btnLogFile1.setText(resourceMap.getString("btnLogFile1.text")); // NOI18N
        btnLogFile1.setName("btnLogFile1"); // NOI18N

        javax.swing.GroupLayout pnlCheckLayout = new javax.swing.GroupLayout(pnlCheck);
        pnlCheck.setLayout(pnlCheckLayout);
        pnlCheckLayout.setHorizontalGroup(
            pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCheckLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1)
                    .addComponent(jLabel9))
                .addGap(14, 14, 14)
                .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtSrcFolder, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE)
                    .addComponent(txtTagFolder, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE)
                    .addComponent(txtErrFolder, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE)
                    .addComponent(txtChkXMLLog, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnErrFld, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnTgrFld, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSrcFld, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnLogFile1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        pnlCheckLayout.setVerticalGroup(
            pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCheckLayout.createSequentialGroup()
                .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCheckLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txtSrcFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addGap(9, 9, 9)
                        .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2)
                            .addComponent(txtTagFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4)
                            .addComponent(txtErrFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(pnlCheckLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel9)
                            .addComponent(txtChkXMLLog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlCheckLayout.createSequentialGroup()
                        .addComponent(btnSrcFld)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnTgrFld)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnErrFld)
                        .addGap(9, 9, 9)
                        .addComponent(btnLogFile1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnConvert.setAction(actionMap.get("ActionConvert")); // NOI18N
        btnConvert.setText(resourceMap.getString("btnConvert.text")); // NOI18N
        btnConvert.setName("btnConvert"); // NOI18N

        btnClose.setAction(actionMap.get("quit")); // NOI18N
        btnClose.setText(resourceMap.getString("btnClose.text")); // NOI18N
        btnClose.setName("btnClose"); // NOI18N

        javax.swing.GroupLayout pnlDKTLayout = new javax.swing.GroupLayout(pnlDKT);
        pnlDKT.setLayout(pnlDKTLayout);
        pnlDKTLayout.setHorizontalGroup(
            pnlDKTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDKTLayout.createSequentialGroup()
                .addGap(136, 136, 136)
                .addComponent(btnCheckXML, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnConvert, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(238, Short.MAX_VALUE))
            .addGroup(pnlDKTLayout.createSequentialGroup()
                .addGroup(pnlDKTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(pnlScand, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlCheck, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(pnlDKTLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE)
                .addGap(117, 117, 117))
        );
        pnlDKTLayout.setVerticalGroup(
            pnlDKTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDKTLayout.createSequentialGroup()
                .addComponent(pnlCheck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlScand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(pnlDKTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCheckXML)
                    .addComponent(btnConvert)
                    .addComponent(btnClose))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addComponent(lblDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tabDKT.addTab(resourceMap.getString("pnlDKT.TabConstraints.tabTitle"), resourceMap.getIcon("pnlDKT.TabConstraints.tabIcon"), pnlDKT); // NOI18N

        pnlExTXT.setName("pnlExTXT"); // NOI18N

        txtImport.setText(resourceMap.getString("txtImport.text")); // NOI18N
        txtImport.setName("txtImport"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        txtExport.setText(resourceMap.getString("txtExport.text")); // NOI18N
        txtExport.setName("txtExport"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        btnExport.setAction(actionMap.get("getExportLogs")); // NOI18N
        btnExport.setText(resourceMap.getString("btnExport.text")); // NOI18N
        btnExport.setName("btnExport"); // NOI18N

        btnCloseEx.setAction(actionMap.get("quit")); // NOI18N
        btnCloseEx.setText(resourceMap.getString("btnCloseEx.text")); // NOI18N
        btnCloseEx.setName("btnCloseEx"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        btnGroupRadio.add(radText);
        radText.setSelected(true);
        radText.setText(resourceMap.getString("radText.text")); // NOI18N
        radText.setName("radText"); // NOI18N

        btnGroupRadio.add(radOracle);
        radOracle.setText(resourceMap.getString("radOracle.text")); // NOI18N
        radOracle.setName("radOracle"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radOracle, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(radText, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(447, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(radText)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, Short.MAX_VALUE)
                .addComponent(radOracle))
        );

        javax.swing.GroupLayout pnlExTXTLayout = new javax.swing.GroupLayout(pnlExTXT);
        pnlExTXT.setLayout(pnlExTXTLayout);
        pnlExTXTLayout.setHorizontalGroup(
            pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlExTXTLayout.createSequentialGroup()
                .addGap(188, 188, 188)
                .addComponent(btnExport)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnCloseEx, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(337, Short.MAX_VALUE))
            .addGroup(pnlExTXTLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlExTXTLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlExTXTLayout.createSequentialGroup()
                        .addGroup(pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(pnlExTXTLayout.createSequentialGroup()
                                .addGap(88, 88, 88)
                                .addComponent(txtExport, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE))
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlExTXTLayout.createSequentialGroup()
                                .addGap(88, 88, 88)
                                .addComponent(txtImport, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)))
                        .addGap(108, 108, 108))))
        );
        pnlExTXTLayout.setVerticalGroup(
            pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlExTXTLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(txtImport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(txtExport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlExTXTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnExport)
                    .addComponent(btnCloseEx))
                .addContainerGap(294, Short.MAX_VALUE))
        );

        tabDKT.addTab(resourceMap.getString("pnlExTXT.TabConstraints.tabTitle"), pnlExTXT); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabDKT, javax.swing.GroupLayout.DEFAULT_SIZE, 708, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabDKT, javax.swing.GroupLayout.DEFAULT_SIZE, 507, Short.MAX_VALUE)
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 708, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 538, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        jFileChooser1.setName("jFileChooser1"); // NOI18N

        jFileChooser2.setName("jFileChooser2"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    @Action
    public void PartSrcFolder() {    
        getDirectory('S');
    }
    
    @Action
    public void PartTgrFolder() {
        getDirectory('T');
    }

    @Action
    public void PartBckFolder() {
        getDirectory('B');
    }
    
    @Action
    public void PartErrFolder() {
        getDirectory('E');
    }
    
    @Action
    public void PartLogFile() {
        getDirectory('L');
    }
    
    @Action
    public void PartScandFolder() {
        getDirectory('C');
    }
    
    
    /**
     * Display file choose
     * @param c 
     */
    public void getDirectory(char c){
        fc.showOpenDialog(btnCheckXML);
        File file = fc.getCurrentDirectory();
        switch(c){
            case 'S': 
                txtSrcFolder.setText(file.getPath());
                break;
            case 'T':
                txtTagFolder.setText(file.getPath());
                break;
            case 'E':
                txtErrFolder.setText(file.getPath());
                break;
            case 'B':
                txtBckFolder.setText(file.getPath());
                break;
            case 'L':
                file = fc.getSelectedFile();
                txtFileLog.setText(file.getPath());
                break;
            case 'C':                
                txtScandFolder.setText(file.getPath());
                break;    
            default:
                break;
        }
    }
    
    /**
     * 
     * @param srcFolder
     * @param errFolder
     * @return check thành công
     * @throws SAXException
     * @throws IOException
     * @throws ParserConfigurationException
     * @throws ExceptionInInitializerError
     * @throws JCoException 
     */
    public static String checkParseXML(String srcFolder, String errFolder) throws    SAXException, IOException, ParserConfigurationException, ExceptionInInitializerError, JCoException
        {
            FileReader f_reader = null;
            BufferedReader  br = null;
            XMLReader xr = null;     
            File f_xml = null;
            String f_name = "";
            File dirForder = null;
            File dirFile = null;
            File crtForder = null;
            try{                     
                // Forder file scand
                dirForder = new File(srcFolder);                

                //Scand list folder
                for( File f : dirForder.listFiles()){                
                    //Dir forder chứa file xml
                    dirFile = new File(srcFolder+"\\"+f.getName());                   
                    
                    for(File l: dirFile.listFiles()){
                        
                        //Create forder cqt 
                        String tgrFld = txtTagFolder.getText()+f.getName();
                        crtForder = new File (tgrFld);
                        crtForder.mkdir();
                        if (!crtForder.exists())
                        {
                                crtForder.mkdir();
                        }
                        
                        // get file XML
                        int endIndex = l.getName().length();
                        int beginIndex = endIndex-3;
                        // Scan file có định dạng .XML
                        if(l.getName().substring(beginIndex, endIndex).equals("xml")){
                            f_name = l.getName();
                            f_xml = new File(dirFile+"\\"+l.getName());
                            InputSource input = null;
                            // Create SAX 2 parser...
                            xr = XMLReaderFactory.createXMLReader();
                            f_reader = new FileReader(f_xml);
                            br = new BufferedReader(f_reader);
                            input = new InputSource(br);
                            xr.parse(input);
                            //Move file khi đọc file thành công                                  
                            Utility.moveFiles(f_xml.toString(),tgrFld);
                        }
                      }
                    }
               }
               catch (SAXParseException err_){
                logger.log(Level.WARNING,"Lỗi RuntimeExceptions trong cấu trúc file xml:"+f_name+":"+err_.getLineNumber()+":"+err_.getMessage());   
                f_reader.close();       
                
               String tgrFld = errFolder+dirFile.getName();
               crtForder = new File (tgrFld);
               if (!crtForder.exists())
                    {
                            crtForder.mkdir();
                    }          
                //Move file error
                Utility.moveFiles(f_xml.toString(),tgrFld);
                //Quét lại
                return checkParseXML(srcFolder, errFolder);                
           }
            catch(Exception ex){
            ex.printStackTrace();
            }            
            finally{}
            
            return "DONE !!!";
        }
    /**
     * Check file xml
     * @throws ParserConfigurationException
     * @throws SAXException
     * @throws IOException
     * @throws JCoException 
     */
    @Action
    public void checkXML() throws ParserConfigurationException, SAXException, IOException, JCoException {
        try
          {             
                Long s_check = System.currentTimeMillis();
                FileHandler fh = new FileHandler(txtChkXMLLog.getText(), true);
                logger = Logger.getLogger(Constants.LOGGER_NAME);
                lm.addLogger(logger);                
                logger.addHandler(fh);
                lblDisplay.setText("PLEASE WAIT ... CHECKING & COPPING PARSE FILE XML.");
                // *** 01.Thực hiện check file xml ***
                lblDisplay.setText(checkParseXML(txtSrcFolder.getText(), txtErrFolder.getText()));                
                // *** 02.Thực hiện copy file xml ***
                //lblDisplay.setText("PLEASE WAIT ... COPYING.");
                //Utility.copyDirectory(new File(txtSrcFolder.getText()), new File(txtTagFolder.getText()));
                lblDisplay.setText("Completed within " + (System.currentTimeMillis() - s_check)/1000 +" seconds!!!");
                
               fh.close();
          }
          catch(IOException ex){
            logger.log(Level.WARNING,"Lỗi IOException trong cấu trúc file xml: "+ReadXML.getFile_name() , ex.getMessage());            
          }
          catch (RuntimeException e){
             logger.log(Level.WARNING,"Lỗi RuntimeExceptions trong cấu trúc file xml: "+ReadXML.getFile_name(), e.getMessage());
          }
          catch (SAXParseException err) {
            logger.log(Level.WARNING,"Lỗi SAXParseException trong cấu trúc file xml, kiểm tra lại cấu trúc các thẻ trong file: "+ReadXML.getFile_name() , err.getMessage()+" Exception: "+err.getException());
          } 
    }

    /**
     * Convert dữ liệu ĐKT
     * @throws ParserConfigurationException
     * @throws SAXException
     * @throws IOException
     * @throws ExceptionInInitializerError
     * @throws JCoException 
     */
    @Action
    public void ActionConvert() throws ParserConfigurationException, SAXException, IOException, ExceptionInInitializerError, JCoException {
        try
          {
                //System.out.println("Test performance|Bắt đầu chạy tool ....: "+System.currentTimeMillis());
                FileHandler fh = new FileHandler(txtFileLog.getText(), true);
                //Lấy log class ConvertDKT
                logger = Logger.getLogger("ConvertDKT");
                lm.addLogger(logger);                
                logger.addHandler(fh);
                //Scand file xml
                lblDisplay.setText("PLEASE WAIT .... CONVERTING.");
                int num_process = 0;
                //Check convert address
                String c_add = "";
                if(chkAddress.isSelected()){
                    c_add = "X";
                }
                //Check delete CACO
                String del_caco = "";
                if(chkDelCACO.isSelected()){
                    del_caco = "X";
                }
                if (Utility.isNumber(txtThread.getText()))      
                {
                    num_process = Integer.parseInt(txtThread.getText());
                    ReadXML.readXML(txtScandFolder.getText(), txtBckFolder.getText(), num_process,c_add,del_caco);               
                    //Chạy lại lần 2 cho trường hợp copy thêm file vào
                    ReadXML.readXML(txtScandFolder.getText(), txtBckFolder.getText(), num_process,c_add,del_caco);
                    lblDisplay.setText("DONE !!!");
                    fh.close();
                }
                else{
                    JOptionPane.showConfirmDialog(btnConvert, "Input number thread", txtBckFolder.getText()+ " isn't number!",JOptionPane.CLOSED_OPTION);                    
                }
                
          }
          catch(IOException ex){
            logger.log(Level.WARNING,"Lỗi IOException trong cấu trúc file xml: "+ReadXML.getFile_name() , ex.getMessage());   
            lblDisplay.setText("Xin hãy kiểm tra lại file "+ReadXML.getFile_name());   
          }
          catch (RuntimeException e){               
              JOptionPane.showMessageDialog(btnConvert, "Xin hãy kiểm tra lại file "+ReadXML.getFile_name(), "Lỗi cấu trúc file", busyIconIndex, idleIcon);
              lblDisplay.setText("Xin hãy kiểm tra lại file "+ReadXML.getFile_name());              
       }
          catch (SAXParseException err) {
            logger.log(Level.WARNING,"Lỗi SAXParseException trong cấu trúc file xml, kiểm tra lại cấu trúc các thẻ trong file: "+ReadXML.getFile_name() , err.getMessage()+" Exception: "+err.getException());
            lblDisplay.setText("Xin hãy kiểm tra lại file "+ReadXML.getFile_name());   
          }        
    }
    /**
     * Display file convert success
     * @param file 
     */
     public static void getSuccesFile(String file){          
          lblDisplay.setText(file);
      }   
     @Action
     public void getExportLogs(){    
         char val_ = 0;
         if(radText.isSelected()){
             val_ = 'O';
         }
         if(radOracle.isSelected()){
             val_ = 'X';
         }
         try{
             Utility.exLog(txtImport.getText(), txtExport.getText(), val_);
         }
         catch (Exception e)
         {
          e.getMessage();
         }
      }


    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBckFld;
    private javax.swing.JButton btnCheckXML;
    private javax.swing.JButton btnClose;
    private javax.swing.JButton btnCloseEx;
    private javax.swing.JButton btnConvert;
    private javax.swing.JButton btnErrFld;
    private javax.swing.JButton btnExport;
    private javax.swing.ButtonGroup btnGroupRadio;
    private javax.swing.JButton btnLogFile;
    private javax.swing.JButton btnLogFile1;
    private javax.swing.JButton btnSndFld;
    private javax.swing.JButton btnSrcFld;
    private javax.swing.JButton btnTgrFld;
    private javax.swing.JCheckBox chkAddress;
    private javax.swing.JCheckBox chkDelCACO;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JFileChooser jFileChooser2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblDelCACO;
    private static java.awt.Label lblDisplay;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JPanel pnlCheck;
    private javax.swing.JPanel pnlDKT;
    private javax.swing.JPanel pnlExTXT;
    private javax.swing.JPanel pnlScand;
    private javax.swing.JProgressBar progressBar;
    public static javax.swing.JRadioButton radOracle;
    public static javax.swing.JRadioButton radText;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JTabbedPane tabDKT;
    private javax.swing.JTextField txtBckFolder;
    private javax.swing.JTextField txtChkXMLLog;
    private javax.swing.JTextField txtErrFolder;
    private javax.swing.JTextField txtExport;
    private javax.swing.JTextField txtFileLog;
    private javax.swing.JTextField txtImport;
    private javax.swing.JTextField txtScandFolder;
    private javax.swing.JTextField txtSrcFolder;
    private static javax.swing.JTextField txtTagFolder;
    private javax.swing.JTextField txtThread;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;    

    JFileChooser fc = new JFileChooser();    
    // Log
    static LogManager lm = LogManager.getLogManager();
    static Logger logger;    
}
